package in.abip.chisame.model;

import in.abip.chisame.R;

/**
 * Room record.
 * 
 * @author Julot
 * @since Friday, January 21th, 2011.
 */
public class Room extends CActiveRecord implements IListItem {
	public String name = null;
	public Integer typeId = null;
	
	public static Room model() {
		return new Room();
	}
	
	public String getTypeName() {
		switch (typeId) {
		case 1: return "Default";
		case 2: return "Bed Room";
		case 3: return "Dining Room";
		case 4: return "Entrance";
		case 5: return "Family Room";
		case 6: return "Guest Room";
		case 7: return "Kitchen";
		case 8: return "Lobby";
		case 9: return "Meeting Room";
		case 10: return "Outside/Garden";
		default: return "Stair";
	    }
	}
	
	public int getListIconResource() {
		switch (typeId) {
		case 1: return R.drawable.ic_list_room_type_1;
		case 2: return R.drawable.ic_list_room_type_2;
		case 3: return R.drawable.ic_list_room_type_3;
		case 4: return R.drawable.ic_list_room_type_4;
		case 5: return R.drawable.ic_list_room_type_5;
		case 6: return R.drawable.ic_list_room_type_6;
		case 7: return R.drawable.ic_list_room_type_7;
		case 8: return R.drawable.ic_list_room_type_8;
		case 9: return R.drawable.ic_list_room_type_9;
		case 10: return R.drawable.ic_list_room_type_10;
		default: return R.drawable.ic_list_room_type_11;
	    }
	}

	public String getListText() {
		return ((name == null) || (name.equals(""))) ? getTypeName() : name;
	}
	
	/**
	 * Used by spinner.
	 */
	public String toString() {
		return name;
	}
}
